@extends('admin.layout.base')
@section('title', '修改内容')
@section('content')
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            修改帮助内容
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ url('/admin') }}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="{{ url('/admin/faq') }}">帮助内容管理</a></li>
            <li class="active">修改内容</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- right column -->
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">修改内容</h3>
                    </div>
                    <!-- /.box-header -->
                    @if(session('errors'))
                    <div class="alert alert-danger alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @foreach($errors->all() as $key => $error)
                        {{ $key+1 . ':' . $error }}
                        @endforeach
                    </div>
                    @endif
                    <!-- form start -->
                    <form class="form-horizontal" action="{{ url('/admin/faq',[$data->id]) }}" method="post">
                        {!! csrf_field() !!}
                        {{ method_field('PUT') }}
                        <div class="box-body">
                            <div class="form-group">
                                <label for="faq_title" class="col-sm-2 control-label">内容标题</label>
                                <div class="col-sm-5">
                                    <input type="faq_title" class="form-control" id="faq_title" name="faq_title" value="{{ $data->faq_title }}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="pid" class="col-sm-2 control-label">广告位置</label>
                                <div class="col-sm-5">
                                    <select name="pid" id="pid" class="form-control">
                                        <option value="">-- 请选择 --</option>
                                        @foreach($cates as $k => $c)
                                        <option value="{{ $k }}" {{ $k == $data->pid ? 'selected' : ''}}>{{ $c }}</option>
                                        @endforeach
                                        </optgroup>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="faq_content" class="col-sm-2 control-label">内容</label>
                                <div class="col-sm-8">
                                    <textarea name="faq_content" id="faq_content" rows="10">{!! $data->faq_content !!}</textarea>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="button" class="btn btn-default" onclick="history.go(-1)">返回</button>
                            <button type="submit" class="btn btn-info pull-right">修改</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
                <!-- /.box -->
            </div>
            <!--/.col (right) -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
@endsection
@section('pluginscript')
<!-- FastClick -->
<script src="{{ asset('/dist/admin/plugins/fastclick/fastclick.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ asset('/plugins/ueditor/ueditor.config.js') }}"></script>
<script type="text/javascript" charset="utf-8" src="{{ asset('/plugins/ueditor/ueditor.all.min.js') }}"></script>
<script type="text/javascript">
$(function(){
    // 实例化文本编辑器
    var content = UE.getEditor('faq_content');
});
</script>
@endsection